package com.study.forumsystemproject.dao;

import com.study.forumsystemproject.model.Article;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ArticleMapper {
    int insert(Article row);

    int insertSelective(Article row);

    Article selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(Article row);

    int updateByPrimaryKeyWithBLOBs(Article row);

    int updateByPrimaryKey(Article row);

    /**
     * Description: 加载所有列表信息
     * return: Board列表
     * Author: xiaoxie
     * Date: 20:34 2024/8/17
    */
    List<Article> selectAll(@Param("offset") Integer offset,  @Param("limit") Integer limit);
    /**
     * Description: 根据不同版块加载相应的列表信息
     * return: Board列表
     * Author: xiaoxie
     * Date: 20:34 2024/8/17
     */
    List<Article> selectByBoardId(@Param("boardId") Long boardId, @Param("offset") Integer offset, @Param("limit") Integer limit);
    Article selectDetailsByArticleId(Long id);
    /**
     * Description: 根据用户Id查询帖子列表信息
     * Param:  userId
     * return: 帖子列表
     * Author: xiaoxie
     * Date: 18:13 2024/8/19
    */
    List<Article> selectDetailsByUserId(Long userId);

    @Select("select count(1) from t_article")
    Integer total();
}